﻿using System;

using Microsoft.VisualStudio.TextManager.Interop;
using Microsoft.WowAddonStudio.Lua.Parser;

namespace Microsoft.WowAddonStudio.Lua.LanguageService.Support
{
    public static class LexLocationExtensions
    {
        public static TextSpan ToTextSpan(this LexLocation location)
        {
            if (location == null)
                throw new ArgumentNullException("location");

            return new TextSpan
                   {
                       iStartLine = location.Line,
                       iStartIndex = location.Column,
                       iEndLine = location.EndLine,
                       iEndIndex = location.EndColumn
                   };
        }
    }
}
